package logic

import (
	"context"
	"shell/houserpc/houserpc"

	"shell/api/internal/svc"
	"shell/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type SeekAddLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewSeekAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SeekAddLogic {
	return &SeekAddLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *SeekAddLogic) SeekAdd(req *types.SeekAddRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	add, err := l.svcCtx.HouseRpc.SeekAdd(l.ctx, &houserpc.SeekAddRequest{
		UserId:  req.UserId,
		HouseId: req.HouseId,
		Context: req.Context,
	})
	if err != nil {
		return &types.Response{
			Code:    500,
			Message: err.Error(),
			Data:    nil,
		}, nil
	}
	return &types.Response{
		Code:    500,
		Message: "提问问题成功",
		Data:    add,
	}, nil
}
